package tmproject.hlhj.fhp.cartrans.customVIews

import android.app.Dialog
import android.content.Context
import android.content.pm.ActivityInfo
import android.graphics.Bitmap
import android.os.Bundle
import android.support.v7.app.AppCompatActivity
import kotlinx.android.synthetic.main.dialog_sign.*
import tmproject.hlhj.fhp.cartrans.R
import tmproject.hlhj.fhp.cartrans.activitys.HomeAty
import tmproject.hlhj.fhp.cartrans.utils.CutUtils

/**
 * Created by Never Fear   on 2018\8\28 0028.
Never More....
 */
class SignDialog(private val c: Context,private val listener:OnSignOverListener) :Dialog(c, R.style.MyDialog) {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.dialog_sign)
        drawBack.clear()
        getBitmap.setOnClickListener {
            val aty = c as AppCompatActivity
            aty.requestedOrientation= ActivityInfo.SCREEN_ORIENTATION_PORTRAIT
            val bitmap = CutUtils.loadBitmapFromViewBySystem(drawBack)
            listener.over(bitmap!!)
            getBitmap.postDelayed(Runnable {
                dismiss()
            },500)
        }

        btClear.setOnClickListener {
            drawBack.clear()
        }

    }


    interface OnSignOverListener{
        fun over(bit:Bitmap)
    }
}